

import React, { useEffect } from 'react';
import {useSelector,useDispatch} from "react-redux";
import { getBannerListAction } from '../../rtkAsyncStore/modules/home';
import {getProListAction} from "../../rtkAsyncStore/modules/kind"

export default function Son() {

  const dispatch = useDispatch();
  const bannerList = useSelector(state=>state.home.bannerList);
  const proList = useSelector(state=>state.kind.proList);

  useEffect(()=>{
    dispatch(getBannerListAction);
    dispatch(getProListAction(4))
  },[])

  return (
    <div>
        <h1>子组件</h1>
        <ul>
          {
            bannerList.map(item=><li key={item.bannerid}>{item.bannerid}</li>)
          }
        </ul>
        <input type="button" value="添加轮播图数据"  />
        <hr/>
        
        <ul>
          {
            proList.map(item=><li key={item.proid}>{item.proid}</li>)
          }
        </ul>
    </div>
  )
}

